<?php

class BlockCartController {

    public function invoke() {

        $action = '';
        if (isset($_POST['hdAction'])) {
            $action = $_POST['hdAction'];
        }

        if ($action == 'load') {
            session_start();
            $total = 0;
            if (isset($_SESSION['cart']) && count($_SESSION['cart'] > 0)) {                
                $total = count($_SESSION['cart']);
            }
            echo $total;
            exit();
        }


        $derectory = dirname(__FILE__);
        $xtemplate = new XTemplate($derectory . DS . 'views' . DS . 'cart.html');
        $xtemplate->parse('main');
        $xtemplate->out('main');
    }

}

?>
